package com.liuhm.bfs;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 图结构
 *
 * @author liuhaomin
 * @date 2020/12/28
 */
@Data
public class Dag implements Serializable {
    private static final long serialVersionUID = -1469367483670741447L;
    private List<Vertex> vertexs;

    public Dag() {
        this.vertexs = new ArrayList<>();
    }

    public void addVertex(Vertex vertexDTO){
        vertexs.add(vertexDTO);
    }

    public void addEdge(Vertex from, Vertex to){
        from.getChildren().add(to);
        to.getParents().add(from);
    }

}
